Asynchronous programming includes events occurring independently of the main program flow, allowing the main program flow to continue processing. In stack-based programming languages, such as the C programming language and many derivative languages, asynchronous programming may be very difficult. Since each function in a program can only return once, if the program performs a task (e.g., by calling a function) that will block the processing device for a relatively long period of time, then the task may be divided into smaller functions. As the complexity of the task increases, so does the number of functions and the degree of complexity of state (e.g., the contents of processing device registers) which must be maintained between these functions. Further, since this state cannot be stored on the main processing stack it is put into other currently unallocated memory (e.g., the heap), which requires the programmer or administrator to manage the life-cycle of the state. Conventionally, this complex asynchronous programming has been solved by executing portions of the program code in parallel via processing threads. Parallel execution, however, may present problems, including the synchronization of state between the parallel stacks.
Incremental processing includes recomputing, by a program, only those outputs that depend on a piece of changed data, rather than recomputing all of the outputs. The problem with incremental processing is closely related to that of asynchronous programming. Take for example, a function which returns a number of results in response to a query. If the number of results is small, the program need only allocate a small portion of memory to hold these results. The program also only uses the resources needed to load the small number of results. The resources may include processing device usage, disk/network input/out put (I/O), etc. If, however, the caller of the function only needs to know the first result (or one or more other early result(s)) for example, the resources used to acquire all of the remaining results have been wasted. For queries that return a large number of results, the amount of time and resources wasted can become significant. This problem becomes increasingly acute when dealing with low-memory devices, such as mobile phones, set-top boxes, virtual machines, etc., which lack the higher level language constructs such as symmetric co-routines which would allow a program to incrementally call the function and get just one (or a few) result per call.